﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.ParturitionCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.ParturitionCommandHandler
{
    public class ParturitionAddCommandHandler : IRequestHandler<ParturitionAddCommand, int>
    {
        private readonly IParturitionService _parturitionService;
        public ParturitionAddCommandHandler(IParturitionService parturitionService)
        {
            _parturitionService = parturitionService;
        }
        public async Task<int> Handle(ParturitionAddCommand request, CancellationToken cancellationToken)
        {
            var result =await _parturitionService.AddChildbirth(request.childbirths);
            return result;
        }
    }
}
